package com.qdlc.p2p.biz.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by hongbl on 2016/2/3.
 */
public enum EnumTache {
    //注册活动
    REGISTER("register", "注册活动"),
    //好友邀请
    INVITE("invite", "好友邀请活动"),
    //投标活动（针对每次投标）
    TENDER("tender", "投标活动"),
    //投电影票标
    MOVIETENDER("movie_tender", "趣影投标活动"),
    //投标活动（针对第一次投标）
    FIRSTTENDER("first_tender", "第一次投标活动"),
    //系统赠送
    SYSTEM("system", "系统赠送"),
    //用户签到
    SIGN("sign", "签到活动"),
    //用户抽奖
    LOTTERY("lottery", "抽奖活动");

    private final static Map<String, EnumTache> map = new HashMap<String, EnumTache>();

    String enTache;

    String cnTache;

    EnumTache(String enTache, String cnTache) {
        this.enTache = enTache;
        this.cnTache = cnTache;
    }

    public String getTacheEnName() {
        return enTache;
    }

    public String getTacheCnName() {
        return cnTache;
    }

    public static String getTacheByEnName(String tacheEnName) {
        if (map.get(tacheEnName) == null) {
            for (EnumTache tache : EnumTache.values()) {
                map.put(tache.getTacheEnName(), tache);
                if (tacheEnName.equals(tache.getTacheEnName())) {
                    return tache.getTacheCnName();
                }
            }
        } else {
            return map.get(tacheEnName).getTacheCnName();
        }
        return "";
    }
}
